package JSE_02.Set.Demo01;

import java.util.HashSet;

public class DemoHashSetSavePerson {
    public static void main(String[] args) {
        HashSet<Person> set=new HashSet<>();
        Person p1=new Person("小美",19);
        Person p2=new Person("小美",19);
        Person p3=new Person("小红",20);

        System.out.println(p1.hashCode());
        System.out.println(p2.hashCode());
        System.out.println(p3.hashCode());
        System.out.println("==========");
        System.out.println(p1==p2);
        System.out.println(p1.equals(p2));
        System.out.println("===============");
        set.add(p1);
        set.add(p2);
        set.add(p3);
        System.out.println(set);

    }
}
